
package com.feicheng.iou.sms.util;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.PropertySource;
import org.springframework.stereotype.Component;

/**
 * @Author tianchunlei
 * @Des 短信发送时参数的初始化类
 * @Date 2021/7/23
 **/
@Component
@PropertySource(value = "classpath:sms.properties",encoding = "UTF-8")
public class ConstantPropertiesUtils implements InitializingBean {

    //服务器地址
    @Value("${aliyun.sms.regionId}")
    private String regionId;

    //阿里云中accessKeyId
    @Value("${aliyun.sms.accessKeyId}")
    private String accessKeyId;

    //阿里云中secret
    @Value("${aliyun.sms.secret}")
    private String secret;

    @Value("${aliyun.sms.signName}")
    private String signName;

    @Value("${aliyun.sms.templateCode}")
    private String templateCode;

    public static String REGION_ID;
    public static String ACCESS_KEY_ID;
    public static String SECRET;
    public static String SIGN_NAME;
    public static String TEMPLATE_CODE;

    @Override
    public void afterPropertiesSet() throws Exception {
        REGION_ID = regionId;
        ACCESS_KEY_ID = accessKeyId;
        SECRET = secret;
        SIGN_NAME = signName;
        TEMPLATE_CODE = templateCode;
    }
}